<template>
  <div>
    <home-header ></home-header>
    <home-swiper :swiperList = "swiperList"></home-swiper>
    <home-icons :iconList="iconList" v-if="iconList.length"></home-icons>
    <home-recommend :recommendList="recommendList" ></home-recommend>
    <home-weekend :weekendList="weekendList"></home-weekend>
  </div>
</template>
<script>
import HomeHeader from './components/Header.vue'
import HomeSwiper from './components/Swiper.vue'
import HomeIcons from './components/Icons'
import HomeRecommend from './components/Recommend'
import HomeWeekend from './components/Weekend'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeekend
  },
  data () {
    return {
      swiperList: [],
      iconList: [],
      recommendList: [],
      weekendList: []
    }
  },
  methods: {
    getInfos () {
      let cthis = this
      axios.get('/api/index.json').then(function (res) {
        console.log(res)
        if (res.data && res.data.ret) {
          console.log(res)
          console.log(res.data)
          console.log(typeof res.data)
          cthis.swiperList = res.data.data.swiperList
          cthis.iconList = res.data.data.iconList
          cthis.recommendList = res.data.data.recommendList
          cthis.weekendList = res.data.data.weekendList
        }
      })
    }
  },
  mounted () {
    this.getInfos()
  }
}
</script>
<style scoped>

</style>
